<template>
	<view>
		<!-- <view class="title">
			患者情况
		</view>
		<view class="formItem">
			<view class="question">
				1.疼痛控制是否满意度（1-5分）
			</view>
			<view class="cu-form-group">
				<view class="tex-input-desc">{{form.painControl}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				2.患者对自己的疼痛进行评分
			</view>
			<view class="cu-form-group">
				<view class="tex-input-desc">{{form.painMyselfControl}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				3.是否服用镇痛药？
			</view>
			<view class="cu-form-group">
				<view class="tex-input-desc">{{form.painkillers}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				4.服用何种镇痛药？剂量/频次
			</view>
			<view class="cu-form-group">
				<view class="tex-tarea-desc">{{form.painkillersDesc}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				5.爆发痛缓解情况
				
			</view>
			<view class="cu-form-group">
				<view class="tex-tarea-desc">{{form.painDesc}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				6.患者有哪些问题？
			</view>
			<view class="cu-form-group">
				<view class="tex-tarea-desc">{{form.patientDesc}}</view>
			</view>
		</view> -->
		<!-- <view class="title">
			医生反馈
		</view> -->
		<view class="formItem">
			<view class="question">
				1.随访方式
			</view>
			<view class="cu-form-group">
				<view class="tex-input-desc">{{form.patientWay}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				2.专归
			</view>
			<view class="cu-form-group">
				<view class="tex-input-desc">{{form.returnTo}}</view>
			</view>
		</view>
		<view class="formItem">
			<view class="question">
				3.对患者的建议(复诊、调整剂量、换药等)
			</view>
			<view class="cu-form-group">
				<view class="tex-tarea-desc">{{form.patientOffer}}</view>
			</view>
		</view>
		<view class="formItem">
		</view>
	</view>
</template>

<script>
import { toast, useRouter } from '../../../utils/utils';
	export default {
		data() {
			return {
				index: -1,
				picker: ['是', '否'],
				indexScore1:-1,
				pickerScore1: ["1分", "2分","3分","4分","5分"],
				indexScore2:-1,
				pickerScore2:["1分", "2分","3分","4分","5分"],
				id: "",
				modalName:"qqq",
				form: {
					"painControl": "",
					"painDesc": "",
					"painMyselfControl": "",
					"painkillers": "",
					"painkillersDesc": "",
					"patientDesc": "",
					"patientId": null,
					"patientOffer": "",
					"patientWay": "",
					"returnTo": "",
					"id":null
				},


			}
		},
		async onLoad(options) {
			let data = decodeURIComponent(options.data)
			let params = JSON.parse(data)
			this.id = params.id
			await this.getPatientDetail();
		},
		methods: {
			//获取详情
			async getPatientDetail() {
				let res = await this.$api.getPatientDetail({
					id: this.id
				});
				if(res.sysPatientFollowEntity){
					let result = res.sysPatientFollowEntity
					Object.keys(result).forEach((key) => {
					  if (this.form.hasOwnProperty(key)) {
					    this.form[key] = result[key]==null?"":result[key];
					  }
					});
					//根据值设置下拉下标
					this.setPrickerIndex("index","picker",this.form.painkillers);
					this.setPrickerIndex("indexScore1","pickerScore1",this.form.painControl);
					this.setPrickerIndex("indexScore2","pickerScore2",this.form.painMyselfControl);
				}
			},
			setPrickerIndex(indexName,prickerName,value){
				this[indexName] = this[prickerName].indexOf(value);
			}
			
		}
	}
</script>

<style lang="scss">
	.title {
		font-size: 38rpx;
		font-weight: bold;
		display: flex;
		justify-content: center;
		padding: 10rpx;
		background-color: #fff;
	}

	.formItem {
		background-color: #fff;
		padding: 10px;

		.question {
			font-size: 30rpx;
			margin-bottom: 10rpx;
		}

		.cu-form-group {
			background-color: #f5f5f5;
			min-height: 90rpx;
			.tex-tarea-desc {
				height:196rpx;
				padding-top: 10rpx;
				padding-bottom: 10rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				/* 超出部分省略号 */
				display: -webkit-box;
				/** 对象作为伸缩盒子模型显示 **/
				-webkit-box-orient: vertical;
				/** 设置或检索伸缩盒对象的子元素的排列方式 **/
				-webkit-line-clamp: 5;
				/** 显示的行数 **/
			}
			.tex-input-desc {
				line-height: 66rpx;
				padding-top: 10rpx;
				padding-bottom: 10rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				/* 超出部分省略号 */
				display: -webkit-box;
				/** 对象作为伸缩盒子模型显示 **/
				-webkit-box-orient: vertical;
				/** 设置或检索伸缩盒对象的子元素的排列方式 **/
				-webkit-line-clamp: 1;
				/** 显示的行数 **/
			}
		}

		.cu-form-group uni-picker,picker .picker {
			line-height: 90rpx;
			text-align: left;
		}
		
		
	}
</style>